/*
 * MainBackground.fx
 *
 * Created on 20.2.2010, 13:28:
 */
package com.gpsbuddy.components;

import javafx.scene.CustomNode;
import javafx.scene.Node;
import javafx.scene.image.ImageView;
import javafx.scene.image.Image;
import javafx.scene.Group;
import javafx.scene.shape.Rectangle;
import javafx.scene.paint.Color;
import com.gpsbuddy.utils.Utils;

/**
 * @author jonycus
 */
public class MainBackground extends CustomNode {

    var width: Number = bind scene.width;
    var height: Number = bind scene.height;
    var rect = Rectangle {
                width: bind width;
                height: bind height;
                fill: Color.WHITE;
            }
    var image: Image = Image {
                backgroundLoading: true;
                url: "{__DIR__}images/main3.png";
            }
    var bgImage = ImageView {
                image: image;
            }
    var group = Group {
                content: [rect, bgImage]
            }

    override protected function create(): Node {
        if (Utils.isMobile) {
            bgImage.scaleX = 0.5;
            bgImage.scaleY = 0.5;
            bgImage.layoutX = -200;
            bgImage.layoutY = -150;
            }
        return group;
    }

}
